import request from '@/utils/request'

// 查询采购计划列表
export function listPlan(query) {
  return request({
    url: '/cg/plan/list',
    method: 'get',
    params: query
  })
}

// 查询采购计划详细
export function getPlan(planId) {
  return request({
    url: '/cg/plan/' + planId,
    method: 'get'
  })
}

// 新增采购计划
export function addPlan(data) {
  return request({
    url: '/cg/plan',
    method: 'post',
    data: data
  })
}

// 修改采购计划
export function updatePlan(data) {
  return request({
    url: '/cg/plan',
    method: 'put',
    data: data
  })
}

// 删除采购计划
export function delPlan(planId) {
  return request({
    url: '/cg/plan/' + planId,
    method: 'delete'
  })
}
//确认采购计划
export function confirmPlan(data) {
  return request({
    url: '/cg/plan/check/' + data,
    method: 'put'
  })
}
export function getItemByPlanId(planId) {
  return request({
    url: '/cg/plan/getItemByPlanId/' + planId,
    method: 'get'
  })
}
//终止采购计划
export function terminationPlan(planId) {
  return request({
    url: '/cg/plan/termination/' + planId,
    method: 'put'
  })
}
// 继续执行采购计划
export function continuePlan(planId) {
  return request({
    url: '/cg/plan/continue/' + planId,
    method: 'put'
  })
}
// 查询未采购的采购物料
export function getNotPurchasedPlanItem(query) {
  return request({
    url: '/cg/plan/getNotPurchasedPlanItem',
    method: 'get',
    params: query
  })
}
